home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_com_tokarev.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
3KB
|
153 lines
# Jones 3D Cog Script
#
# com_Tokarev.cog
#
# This COG controls the Tokarev Automatic Pistol for bad guys.
#
# [RandyT]
#
# (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
#
# ===================================================================
symbols
message fire
message aim
message activated
message deactivated
message selected
message deselected
sound bang=gen_tokarev_fire.wav local # Autoloaded
template projectile=+tokarev local # Autoloaded
template smoke1=+pistol_smoke1 local # Autoloaded
template smoke2=+pistol_smoke2 local # Autoloaded
thing bandito local
thing bullet local
flex aimFOV=25.0 local
flex aimMax=5.0 local
flex aimWait=0.25 local
flex fireWait=0.52 local
int numFires=0 local
vector firePos local
end
# ===================================================================
code
# -------------------------------------------------------------------
fire:
bandito = GetSourceRef();
# If he's done firing, deactivate the weapon
numFires = GetThingUserData(bandito);
if (numFires == 0)
{
DeactivateCurWeapon(bandito);
return;
}
firePos = GetThingJointPos(bandito, GetNodeByName(bandito, "inrhand"));
bullet = FireProjectile(bandito, projectile, bang, 65, firePos, '0 0 0', 1.0, 0x220, aimFOV, aimMax);
if (bullet == -1) return;
if (Rand() < 0.5) CreateThing(smoke1, bullet);
else CreateThing(smoke2, bullet);
SetFireWait(bandito, fireWait);
# Set the number of shots left
numFires = numFires - 1;
SetThingUserData(bandito, numFires);
return;
# -------------------------------------------------------------------
aim:
bandito = GetSourceRef();
if ( IsModePlaying(bandito, 62) == 0 ) # Weapon drawn?
return;
if ( GetParam(0) ) # Got target?
{
if ( IsModePlaying(bandito, 63) == 0 ) # Not aiming yet?
{
PlayMode(bandito, 63, 0); # Start aiming
SetAimWait(bandito, aimWait);
}
}
else
{
if ( IsModePlaying(bandito, 63) > 0 ) # Currently aiming?
{
StopMode(bandito, 63, aimWait); # Stop aiming
}
}
return;
# -------------------------------------------------------------------
activated:
bandito = GetSourceRef();
SetThingUserData(bandito, GetParam(0));
ActivateWeapon(bandito, aimWait);
return;
# -------------------------------------------------------------------
deactivated:
bandito = GetSourceRef();
SetThingUserData(bandito, 0);
DeactivateWeapon(bandito);
return;
# -------------------------------------------------------------------
selected:
bandito = GetSourceRef();
SetThingFireOffset(bandito, '0.006 0.05 0.015');
SetArmedMode(bandito, 2);
PlayMode(bandito, 62, 0); # Play "draw weapon" anim
SetAimWait(bandito, aimWait);
return;
# -------------------------------------------------------------------
deselected:
bandito = GetSourceRef();
StopMode(bandito, 62, 0); # Stop "draw weapon" anim
StopMode(bandito, 63, 0); # Stop "aiming" anim
SetArmedMode(bandito, 0);
SetThingFireOffset(bandito, '0 0 0');
return;
end